
Page({
    data: {
        experienceList: []
    },
    onShow: function () {
        this.loadExperienceList();
    },
    onLoad: function () {
        this.loadExperienceList();
    },
    loadExperienceList: function () {
        wx.getStorage({
            key: 'experienceList',
            success: (res) => {
                console.log(res.data)
                this.setData({experienceList: res.data});
            }
        })
    },
    navigateToForm: function () {
        wx.navigateTo({
            url: '/pages/resume/form/experience/experience-form/experience-form'
        });
    },
    editExperience: function (e) {
        const index = e.currentTarget.dataset.index;
        // const experience = this.data.experienceList[index];
        wx.navigateTo({
            url: `/pages/resume/form/experience/experience-form/experience-form?index=${index}`
        });
    },
    deleteExperience: function (e) {
        const index = e.currentTarget.dataset.index;
        const experienceList = this.data.experienceList;
        experienceList.splice(index, 1);
        this.setData({experienceList});
        wx.setStorageSync('experienceList', experienceList);
    }
});
